<?php
	session_start();

	if (!isset($_SESSION['login']) && !$_SESSION['login'] == true) {
		header ("Location: index.php");
	}
	
	if(isset($_GET['ID']))
	{
		include ("config.php");
	
		$ToUpdate = $_GET['ID'];
		$companyname = $_POST['companyname'];
		$companyemail = $_POST['companyemail'];

		$_SESSION['Popup'] = $companyname;
		$_SESSION['MessageKey']="saved";
		$stmt = $con->prepare('UPDATE `Company` SET `Name` =  ?,`Email` = ? WHERE `ID` = ?');
		$stmt->bind_param('ssi', $companyname ,$companyemail, $ToUpdate);
		$stmt->execute();

		mysqli_close($con);
		
		header ("Location: listusers.php");
	}
	else
		header ("Location: index.php");
?>